package main

import (
	"fmt"
	"time"
)

func main() {
	//client, err := docker.NewClient("unix:///var/run/docker.sock")
	//if err != nil {
	//	panic(err)
	//}
	//imgs, err := client.ListImages(docker.ListImagesOptions{All: false})
	//if err != nil {
	//	panic(err)
	//}
	//for _, img := range imgs {
	//	fmt.Println("ID: ", img.ID)
	//	fmt.Println("RepoTags: ", img.RepoTags)
	//	fmt.Println("Created: ", img.Created)
	//	fmt.Println("Size: ", img.Size)
	//	fmt.Println("VirtualSize: ", img.VirtualSize)
	//	fmt.Println("ParentId: ", img.ParentID)
	//}
	fmt.Println("Start")
	//statC := make(chan *docker.Stats)
	//done := make(chan bool)
	//err = client.Stats(docker.StatsOptions{
	//	ID:                "some-nginx",
	//	Stats:             statC,
	//	Stream:            true,
	//	Done:              done,
	//})
	//go func() {
	//		if err := client.Stats(docker.StatsOptions{ID: "some-nginx", Stats: statC, Stream:true }); err != nil {
	//			panic(err)
	//		}
	//}()
	fmt.Println("Done")
	//for true {
	//	dockerStats := <-statC
	//	if err != nil {
	//		panic(err)
	//	}
	//	fmt.Println(dockerStats)
	//}
	cTime := make(chan time.Time)
	go func() {
		for  {
			t := time.Now()
			fmt.Printf("%v:%v:%v:%v\n", t.Hour(), t.Minute(), t.Second(), t.Nanosecond())
			cTime <- t
		}

	}()
	for  {
		timer:=time.NewTimer(3*time.Second)
		now:= <- timer.C
		//now := time.Now()
		t := <- cTime
		fmt.Println("main: ", now.Hour(), now.Minute(), now.Second(), now.Nanosecond())
		fmt.Println("routine: ", t.Hour(), t.Minute(), t.Second(), t.Nanosecond())
	}



}